<template>
    <view class="page">
        <view class="report Han">
            <view class="reportItem devideLine" v-for="(repo,repoIndex) in testData" :key="repoIndex"
                @click="gotoAppPermissionSetting">
                <view style="display: flex;align-items: center;">
                    <view class="mdTitle">
                        {{repo.type}}
                    </view>
                    <view class="arrow">
                        <text class="isOpen md2Title mgrey">
                            去设置
                        </text>
                        <image src="../../../static/imgs/detail/arrow.png" mode=""></image>
                    </view>
                </view>
                
                <view class="md6Text intro">
                    {{repo.intro}}
                </view>

            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                testData: [{
                        type: '位置权限',
                        intro: '推荐附近职位、选择目标求职地点等申请此权限',
                        isOpen: true
                    },
                    {
                        type: '相机权限',
                        intro: '使用二维码扫描、拍摄图片等申请此权限',
                        isOpen: true
                    },
                    {
                        type: '相册权限',
                        intro: '聊天时，点击图片-相册、头像上传等申请此权限',
                        isOpen: true
                    },
                    {
                        type: '设备权限',
                        intro: '满足安全风控的需求及确保您的账号安全',
                        isOpen: true
                    },
                ]
            }

        },
        methods: {
            gotoAppPermissionSetting() {
                //#ifdef APP-PLUS
                if (uni.getSystemInfoSync().platform === 'ios') {
                    var UIApplication = plus.ios.import("UIApplication");
                    var application2 = UIApplication.sharedApplication();
                    var NSURL2 = plus.ios.import("NSURL");
                    var setting2 = NSURL2.URLWithString("app-settings:");
                    application2.openURL(setting2);
                    plus.ios.deleteObject(setting2);
                    plus.ios.deleteObject(NSURL2);
                    plus.ios.deleteObject(application2);
                } else {
                    var Intent = plus.android.importClass("android.content.Intent");
                    var Settings = plus.android.importClass("android.provider.Settings");
                    var Uri = plus.android.importClass("android.net.Uri");
                    var mainActivity = plus.android.runtimeMainActivity();
                    var intent = new Intent();
                    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                    var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
                    intent.setData(uri);
                    mainActivity.startActivity(intent);
                }
                //#endif
            }
        },
    }
</script>

<style scoped lang="less">
    .reportItem {
        font-weight: bold;
        padding: 36upx 32upx;
        position: relative;

        .intro {
            // color: #3465B1;
            padding-top: 20upx;
            font-weight: normal;
        }

        .arrow {
            display: flex;
            align-items: center;
            height: 48upx;
            margin-left: auto;


            image {
                width: 48upx;
                height: 48upx
            }
        }
    }
</style>
